import {
  getIndustryEnergyConsumptionTable,
  getIndustryCompanyEnergyConsumptionTable
} from '@/api/energyConsumption';

export default {
  data() {
    return {
      tableData: {}
    };
  },
  computed: {
    energyType() {
      return this.$store.state.energyType;
    }
  },
  methods: {
    async getTableData() {
      try {
        const { data } = await getIndustryEnergyConsumptionTable(
          this.getParams()
        );
        this.tableData = data;
      } catch (e) {
        console.log(e);
      }
    },
    async loadTableMore(tree, treeNode) {
      const industryCode = tree.industryCode;
      const params = this.getParams();
      return getIndustryCompanyEnergyConsumptionTable(industryCode, params);
    },
    handleChangeCheckbox(checked) {
      this.getTableData();
    }
  }
};
